// Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

package com.caigua.mgp.p;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentFactory;
import org.jetbrains.annotations.NotNull;

public class CustomizeToolWindowFactory implements ToolWindowFactory {

  /**
   * Create the tool window content.
   *
   * @param project    current project
   * @param toolWindow current tool window
   */
  public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
    MainWindow mainWindow = new MainWindow(toolWindow);
    ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
    OptionWindow optionWindow = new OptionWindow(toolWindow, project);
    Content main = contentFactory.createContent(mainWindow.getDbConnectPanel(), "连接", false);
    Content option = contentFactory.createContent(optionWindow.getContentPanel(), "编辑", false);
    toolWindow.getContentManager().addContent(main);
    toolWindow.getContentManager().addContent(option);
    mainWindow.setOptionWindow(optionWindow);
  }

}
